<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title>社区</title>
		<link rel="stylesheet" type="text/css" href="../css/hui.css" />
		<link rel="stylesheet" type="text/css" href="../css/common.css" />
		<script src="../js/common/flexible_css.debug.js" type="text/javascript" charset="utf-8"></script>
		<!--<script src="../js/common/flexible.debug.js" type="text/javascript" charset="utf-8"></script>-->
		<style>
			html,body{height:auto;}
			.hui-media-list-img img{width:86px;height:60px;}
			.hui-media-content h1{width:100%;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
			/*.hui-media-content{height:20px;line-height: 20px;}*/
			.hui-media-content div{
				width:100%;
				height: 34px;
				overflow:hidden;
				text-overflow:ellipsis;
				display:-webkit-box; 
				-webkit-box-orient:vertical;
				-webkit-line-clamp:2; 
			}
		</style>
	</head>

	<body>
		<header class="hui-header">
		    <h1>社区</h1>
		    <!--<div id="hui-header-menu" onclick="hui.showSlideMenu();"></div>-->
		</header>
		
		<div class="hui-wrap hui-wrap-bottom">
	    	<div class="hui-center-title" ><h1>社区公告</h1></div>
		    <div class="hui-media-list" style="padding:10px;">
		        <ul class="hui-media-listUl">
		            <li>
		                <a href="javascript:hui.toast('hi...');">
		                    <div class="hui-media-list-img">
		                    	<img src="../img/1.jpg" />
		                    </div>
		                    <div class="hui-media-content">
		                        <h1>标题内容....</h1>
		                        <div>power by hcoder.net</div>
		                    </div>
		                </a>
		            </li>
		        </ul>
		    </div>
		</div>
			<!-- 菜单 dom 结构 -->
			<div class="hui-slide-menu">
			    <ul>
			        <li>菜单1</li>
			        <li>菜单2</li>
			        <li>菜单3</li>
			        <li>菜单4</li>
			        <li style="padding-top:30px;">
			            <button type="button" class="hui-button hui-button-large" onclick="hui.closeSlideMenu();">关闭菜单</button>
			        </li>
			    </ul>
			</div>
		
			<div id="hui-footer">
			    <a href="javascript:void(0)" id="nav-home" >
			        <div class="hui-footer-icons hui-icons-home"></div>
			        <div class="hui-footer-text">健康</div>
			    </a>
			    <a href="javascript:void(0)" id="nav-news"  class="hui-footer-active">
			        <div class="hui-footer-icons hui-icons-news"></div>
			        <div class="hui-footer-text">社区</div>
			    </a>
			    <!--<div style="width:20%; text-align:center;" class="hui-fl">
			        <img src="../img/logo3.jpg" height="44" />
			    </div>-->
			    <a href="javascript:void(0)" id="nav-forum">
			        <div class="hui-footer-icons hui-icons-forum"></div>
			        <div class="hui-footer-text">应用</div>
			    </a>
			    <a href="javascript:void(0)" id="nav-my">
			        <div class="hui-footer-icons hui-icons-my"></div>
			        <div class="hui-footer-text">我的</div>
			    </a>
			</div>
		<script src="../js/hui/hui.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/common/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/script/community.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
//			hui.slideMenu(); 
			//获取新闻类别
			function getnews(){
				hui.ajax({
				    type : 'POST',
				    url : globleobj['domain']+'/company/getnews',
				    data : {},
				    beforeSend : function(){hui.loading();},
				    complete   : function(){hui.closeLoading();},
				    success : function(msg){
				    	console.log('getnewtypes:'+msg)
				    	var data = JSON.parse(msg)
				    	if(data.rc != 0){
				    		hui.toast(data.msg);
				    		return false; 
				    	}
				    	var options = ''; 
						for(var i= 0;i < data.list.length; i++){
							options +=  '<li onclick="gocommunityInfo('+JSON.stringify(data.list[i]).replace(/"/g, "&quot;")+')">'+
				                			'<a href="javascript:void(0)">'+
				                    			'<div class="hui-media-list-img">'+
							                    	'<img src="'+data.list[i].banner+'" />'+
							                    '</div>'+
							                    '<div class="hui-media-content">'+
							                        '<h1>'+(data.list[i].title).replace("<br/>","")+'</h1>'+
							                        '<div>'+data.list[i].content+'</div>'+
							                    '</div>'+
							                '</a>'+
						            	'</li>'
						}
						hui(".hui-media-listUl").html(options)
				    	
				    },
				    error : function(e){
				        console.log(JSON.stringify(e));
				        hui.iconToast('读取消息失败', 'warn');
				    } 
				}); 
			}
			 
			
			function gocommunityInfo(data){
				console.log(JSON.stringify(data));
				localStorage.setItem("communityInfo",JSON.stringify(data));
				hui.open('/html/community/communityInfo.html',{},true); 
				
			}
			
			hui.ready(function(){
				getnews();
				//跳转首页
				hui('#nav-home').click(function(){
				    hui.open('/html/homepage.html',{},true)
				});
				//跳转应用
				hui('#nav-forum').click(function(){
				    hui.open('/html/application.html',{},true)
				});
				//跳转个人中心
				hui('#nav-my').click(function(){
					tokenSure('/html/personcenter.html','login.html?name=personcenter')
				});
				hui.plusReady(function(){
			    	console.log('plusReady')
			    });
			})
		</script>
	</body>
</html>